package tech.yangzhijie.basic.demo02.service.impl;

import com.alibaba.fastjson.JSONObject;
import tech.yangzhijie.basic.demo02.entity.BlackList;
import tech.yangzhijie.basic.demo02.service.BlackListService;
import tech.yangzhijie.basic.demo02.util.HttpClientUtil;


import java.util.HashMap;
import java.util.Map;

public class BlackListServiceImpl implements BlackListService {

    @Override
    public BlackList getBlackList(String idName, String idType, String idNo, String phoneNo, String bankcardNo) {
        //String url = "http://skynet.eloanx.com/moxie/v1/td/blacklist";
        String url = "http://skynet.eloanx.com/moxie/v1/xy/blacklist";
        //String url = "https://www.mankoudai88.com/gateway/skynetx/v1/xy/blacklist";
        Map<String,Object> map = new HashMap<>();
        map.put("idName",idName);
        map.put("idType",idType);
        map.put("idNo",idNo);
        map.put("phoneNo",phoneNo);
        map.put("bankcardNo",bankcardNo);
        String s = HttpClientUtil.sendPost(url, map);
        JSONObject jsonObject = JSONObject.parseObject(s);
        System.out.println(jsonObject.toJSONString());
        //BlackList blackList = new BlackList();
        BlackList blackList = jsonObject.getObject("result", BlackList.class);

//        blackList.setMaxOverdueDays(jsonObject.getString("maxOverdueDays"));
//        blackList.setCode(jsonObject.getString("code"));
//        blackList.setIdType(jsonObject.getString("idType"));
//        blackList.setAccExcNum(jsonObject.getString("accExcNum"));
//        blackList.setCurrentlyPerformanceNum(jsonObject.getString("currentlyPerformanceNum"));
//        blackList.setFee(jsonObject.getString("fee"));
//        blackList.setMemo(jsonObject.getString("memo"));
//        blackList.setCurrentlyOverdueNum(jsonObject.getString("currentlyOverdueNum"));
//        blackList.setMobileNo(jsonObject.getString("mobileNo"));
//        blackList.setIdNo(jsonObject.getString("idNo"));
//        blackList.setBankcardNo(jsonObject.getString("bankcardNo"));
//        blackList.setMaxOverdueAmt(jsonObject.getString("maxOverdueAmt"));
//        blackList.setAccSleepNum(jsonObject.getString("accSleepNum"));
//        blackList.setIdName(jsonObject.getString("idName"));
//        blackList.setLatestOverdueDt(jsonObject.getString("latestOverdueDt"));
//        blackList.setRequestTimes(jsonObject.getString("requestTimes"));
//
//        blackList.setId(jsonObject.getInteger("id"));
//        blackList.setGmtCreated(jsonObject.getDate("gmtCreated"));
//        blackList.setGmtModified(jsonObject.getDate("gmtModified"));
        //gmtModified
        //gmtCreated
        //from
        //id
        return blackList;
    }
}
